package com.zlf.po;


import com.zlf.util.PointUtils;
import lombok.Data;

@Data
public class PointTransaction {
    private Integer ptId;
    private String userId;

    /**
     * 积分值 为正：获取积分 为负：消费积分
     */
    private Integer value;
    private Long expiredTime;
    /**
     * 积分状态
     * 值为x表示剩余x积分未消费，为-1说明已过期，为空说明该记录为消费积分
     */
    private Integer state;
    private Long createTime;

    public PointTransaction(){}

    public PointTransaction(String userId, Integer value){
        this.userId = userId;
        this.value = value;
        createTime= System.currentTimeMillis();
        if (value < 0) {
            this.state = null;
            this.expiredTime = null;
        } else {
            this.state = value;
            this.expiredTime = this.createTime+PointUtils.validTime;
        }
    }

//    public Integer getState() {
//        return this.state;
//    }
//
//    public String getPtId() {
//        return this.ptId;
//    }

}
